// SPDX-License-Identifier: Mulan PSL v2
/*
 * Copyright (c) 2025 Huawei Technologies Co., Ltd.
 * This software is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *         http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

use xgpu_macros::api_hook;

#[api_hook(DriverApi, backend = crate::hook_impl::ipc::driver::DriverApiImpl)]
mod api {
    use std::ffi::{c_char, c_int, c_uchar, c_uint, c_ulonglong, c_ushort, c_void};

    use cudax::driver::*;

    unsafe extern "C" {
        pub fn cuGetErrorString(error: CUresult, p_str: *mut *const c_char) -> CUresult;

        pub fn cuGetErrorName(error: CUresult, p_str: *mut *const c_char) -> CUresult;

        pub fn cuInit(flags: c_uint) -> CUresult;

        pub fn cuDriverGetVersion(driver_version: *mut c_int) -> CUresult;

        pub fn cuDeviceGet(device: *mut CUdevice, ordinal: c_int) -> CUresult;

        pub fn cuDeviceGetCount(count: *mut c_int) -> CUresult;

        pub fn cuDeviceGetName(name: *mut c_char, len: c_int, dev: CUdevice) -> CUresult;

        pub fn cuDeviceGetUuid(uuid: *mut CUuuid, dev: CUdevice) -> CUresult;

        pub fn cuDeviceGetUuid_v2(uuid: *mut CUuuid, dev: CUdevice) -> CUresult;

        pub fn cuDeviceGetLuid(
            luid: *mut c_char,
            device_node_mask: *mut c_uint,
            dev: CUdevice,
        ) -> CUresult;

        pub fn cuDeviceTotalMem_v2(bytes: *mut usize, dev: CUdevice) -> CUresult;

        pub fn cuDeviceGetTexture1DLinearMaxWidth(
            max_width_in_elements: *mut usize,
            format: CUarray_format,
            num_channels: c_uint,
            dev: CUdevice,
        ) -> CUresult;

        pub fn cuDeviceGetAttribute(
            pi: *mut c_int,
            attrib: CUdevice_attribute,
            dev: CUdevice,
        ) -> CUresult;

        pub fn cuDeviceGetNvSciSyncAttributes(
            nv_sci_sync_attr_list: *mut c_void,
            dev: CUdevice,
            flags: c_int,
        ) -> CUresult;

        pub fn cuDeviceSetMemPool(dev: CUdevice, pool: CUmemoryPool) -> CUresult;

        pub fn cuDeviceGetMemPool(pool: *mut CUmemoryPool, dev: CUdevice) -> CUresult;

        pub fn cuDeviceGetDefaultMemPool(pool_out: *mut CUmemoryPool, dev: CUdevice) -> CUresult;

        pub fn cuDeviceGetExecAffinitySupport(
            pi: *mut c_int,
            type_: CUexecAffinityType,
            dev: CUdevice,
        ) -> CUresult;

        pub fn cuFlushGPUDirectRDMAWrites(
            target: CUflushGPUDirectRDMAWritesTarget,
            scope: CUflushGPUDirectRDMAWritesScope,
        ) -> CUresult;

        pub fn cuDeviceGetProperties(prop: *mut CUdevprop, dev: CUdevice) -> CUresult;

        pub fn cuDeviceComputeCapability(
            major: *mut c_int,
            minor: *mut c_int,
            dev: CUdevice,
        ) -> CUresult;

        pub fn cuDevicePrimaryCtxRetain(p_ctx: *mut CUcontext, dev: CUdevice) -> CUresult;

        pub fn cuDevicePrimaryCtxRelease_v2(dev: CUdevice) -> CUresult;

        pub fn cuDevicePrimaryCtxSetFlags_v2(dev: CUdevice, flags: c_uint) -> CUresult;

        pub fn cuDevicePrimaryCtxGetState(
            dev: CUdevice,
            flags: *mut c_uint,
            active: *mut c_int,
        ) -> CUresult;

        pub fn cuDevicePrimaryCtxReset_v2(dev: CUdevice) -> CUresult;

        pub fn cuCtxCreate_v2(p_ctx: *mut CUcontext, flags: c_uint, dev: CUdevice) -> CUresult;

        pub fn cuCtxCreate_v3(
            p_ctx: *mut CUcontext,
            params_array: *mut CUexecAffinityParam,
            num_params: c_int,
            flags: c_uint,
            dev: CUdevice,
        ) -> CUresult;

        pub fn cuCtxDestroy_v2(ctx: CUcontext) -> CUresult;

        pub fn cuCtxPushCurrent_v2(ctx: CUcontext) -> CUresult;

        pub fn cuCtxPopCurrent_v2(p_ctx: *mut CUcontext) -> CUresult;

        pub fn cuCtxSetCurrent(ctx: CUcontext) -> CUresult;

        pub fn cuCtxGetCurrent(p_ctx: *mut CUcontext) -> CUresult;

        pub fn cuCtxGetDevice(device: *mut CUdevice) -> CUresult;

        pub fn cuCtxGetFlags(flags: *mut c_uint) -> CUresult;

        pub fn cuCtxSetFlags(flags: c_uint) -> CUresult;

        pub fn cuCtxGetId(ctx: CUcontext, ctx_id: *mut c_ulonglong) -> CUresult;

        pub fn cuCtxSynchronize() -> CUresult;

        pub fn cuCtxSetLimit(limit: CUlimit, value: usize) -> CUresult;

        pub fn cuCtxGetLimit(pvalue: *mut usize, limit: CUlimit) -> CUresult;

        pub fn cuCtxGetCacheConfig(p_config: *mut CUfunc_cache) -> CUresult;

        pub fn cuCtxSetCacheConfig(config: CUfunc_cache) -> CUresult;

        pub fn cuCtxGetApiVersion(ctx: CUcontext, version: *mut c_uint) -> CUresult;

        pub fn cuCtxGetStreamPriorityRange(
            least_priority: *mut c_int,
            greatest_priority: *mut c_int,
        ) -> CUresult;

        pub fn cuCtxResetPersistingL2Cache() -> CUresult;

        pub fn cuCtxGetExecAffinity(
            p_exec_affinity: *mut CUexecAffinityParam,
            type_: CUexecAffinityType,
        ) -> CUresult;

        pub fn cuCtxAttach(p_ctx: *mut CUcontext, flags: c_uint) -> CUresult;

        pub fn cuCtxDetach(ctx: CUcontext) -> CUresult;

        pub fn cuCtxGetSharedMemConfig(p_config: *mut CUsharedconfig) -> CUresult;

        pub fn cuCtxSetSharedMemConfig(config: CUsharedconfig) -> CUresult;

        pub fn cuModuleLoad(module: *mut CUmodule, fname: *const c_char) -> CUresult;

        pub fn cuModuleLoadData(module: *mut CUmodule, image: *const c_void) -> CUresult;

        pub fn cuModuleLoadDataEx(
            module: *mut CUmodule,
            image: *const c_void,
            num_options: c_uint,
            options: *mut CUjit_option,
            option_values: *mut *mut c_void,
        ) -> CUresult;

        pub fn cuModuleLoadFatBinary(module: *mut CUmodule, fat_cubin: *const c_void) -> CUresult;

        pub fn cuModuleUnload(hmod: CUmodule) -> CUresult;

        pub fn cuModuleGetLoadingMode(mode: *mut CUmoduleLoadingMode) -> CUresult;

        pub fn cuModuleGetFunction(
            hfunc: *mut CUfunction,
            hmod: CUmodule,
            name: *const c_char,
        ) -> CUresult;

        pub fn cuModuleGetFunctionCount(count: *mut c_uint, mod_: CUmodule) -> CUresult;

        pub fn cuModuleEnumerateFunctions(
            functions: *mut CUfunction,
            num_functions: c_uint,
            mod_: CUmodule,
        ) -> CUresult;

        pub fn cuModuleGetGlobal_v2(
            dptr: *mut CUdeviceptr,
            bytes: *mut usize,
            hmod: CUmodule,
            name: *const c_char,
        ) -> CUresult;

        pub fn cuLinkCreate_v2(
            num_options: c_uint,
            options: *mut CUjit_option,
            option_values: *mut *mut c_void,
            state_out: *mut CUlinkState,
        ) -> CUresult;

        pub fn cuLinkAddData_v2(
            state: CUlinkState,
            type_: CUjitInputType,
            data: *mut c_void,
            size: usize,
            name: *const c_char,
            num_options: c_uint,
            options: *mut CUjit_option,
            option_values: *mut *mut c_void,
        ) -> CUresult;

        pub fn cuLinkAddFile_v2(
            state: CUlinkState,
            type_: CUjitInputType,
            path: *const c_char,
            num_options: c_uint,
            options: *mut CUjit_option,
            option_values: *mut *mut c_void,
        ) -> CUresult;

        pub fn cuLinkComplete(
            state: CUlinkState,
            cubin_out: *mut *mut c_void,
            size_out: *mut usize,
        ) -> CUresult;

        pub fn cuLinkDestroy(state: CUlinkState) -> CUresult;

        pub fn cuModuleGetTexRef(
            p_tex_ref: *mut CUtexref,
            hmod: CUmodule,
            name: *const c_char,
        ) -> CUresult;

        pub fn cuModuleGetSurfRef(
            p_surf_ref: *mut CUsurfref,
            hmod: CUmodule,
            name: *const c_char,
        ) -> CUresult;

        pub fn cuLibraryLoadData(
            library: *mut CUlibrary,
            code: *const c_void,
            jit_options: *mut CUjit_option,
            jit_options_values: *mut *mut c_void,
            num_jit_options: c_uint,
            library_options: *mut CUlibraryOption,
            library_option_values: *mut *mut c_void,
            num_library_options: c_uint,
        ) -> CUresult;

        pub fn cuLibraryLoadFromFile(
            library: *mut CUlibrary,
            file_name: *const c_char,
            jit_options: *mut CUjit_option,
            jit_options_values: *mut *mut c_void,
            num_jit_options: c_uint,
            library_options: *mut CUlibraryOption,
            library_option_values: *mut *mut c_void,
            num_library_options: c_uint,
        ) -> CUresult;

        pub fn cuLibraryUnload(library: CUlibrary) -> CUresult;

        pub fn cuLibraryGetKernel(
            p_kernel: *mut CUkernel,
            library: CUlibrary,
            name: *const c_char,
        ) -> CUresult;

        pub fn cuLibraryGetKernelCount(count: *mut c_uint, lib: CUlibrary) -> CUresult;

        pub fn cuLibraryEnumerateKernels(
            kernels: *mut CUkernel,
            num_kernels: c_uint,
            lib: CUlibrary,
        ) -> CUresult;

        pub fn cuLibraryGetModule(p_mod: *mut CUmodule, library: CUlibrary) -> CUresult;

        pub fn cuKernelGetFunction(p_func: *mut CUfunction, kernel: CUkernel) -> CUresult;

        pub fn cuLibraryGetGlobal(
            dptr: *mut CUdeviceptr,
            bytes: *mut usize,
            library: CUlibrary,
            name: *const c_char,
        ) -> CUresult;

        pub fn cuLibraryGetManaged(
            dptr: *mut CUdeviceptr,
            bytes: *mut usize,
            library: CUlibrary,
            name: *const c_char,
        ) -> CUresult;

        pub fn cuLibraryGetUnifiedFunction(
            fptr: *mut *mut c_void,
            library: CUlibrary,
            symbol: *const c_char,
        ) -> CUresult;

        pub fn cuKernelGetAttribute(
            pi: *mut c_int,
            attrib: CUfunction_attribute,
            kernel: CUkernel,
            dev: CUdevice,
        ) -> CUresult;

        pub fn cuKernelSetAttribute(
            attrib: CUfunction_attribute,
            val: c_int,
            kernel: CUkernel,
            dev: CUdevice,
        ) -> CUresult;

        pub fn cuKernelSetCacheConfig(
            kernel: CUkernel,
            config: CUfunc_cache,
            dev: CUdevice,
        ) -> CUresult;

        pub fn cuKernelGetName(name: *mut *const c_char, hfunc: CUkernel) -> CUresult;

        pub fn cuKernelGetParamInfo(
            kernel: CUkernel,
            param_index: usize,
            param_offset: *mut usize,
            param_size: *mut usize,
        ) -> CUresult;

        pub fn cuMemGetInfo_v2(free: *mut usize, total: *mut usize) -> CUresult;

        pub fn cuMemAlloc_v2(dptr: *mut CUdeviceptr, bytesize: usize) -> CUresult;

        pub fn cuMemAllocPitch_v2(
            dptr: *mut CUdeviceptr,
            p_pitch: *mut usize,
            width_in_bytes: usize,
            height: usize,
            element_size_bytes: c_uint,
        ) -> CUresult;

        pub fn cuMemFree_v2(dptr: CUdeviceptr) -> CUresult;

        pub fn cuMemGetAddressRange_v2(
            pbase: *mut CUdeviceptr,
            psize: *mut usize,
            dptr: CUdeviceptr,
        ) -> CUresult;

        pub fn cuMemAllocHost_v2(pp: *mut *mut c_void, bytesize: usize) -> CUresult;

        pub fn cuMemFreeHost(p: *mut c_void) -> CUresult;

        pub fn cuMemHostAlloc(pp: *mut *mut c_void, bytesize: usize, flags: c_uint) -> CUresult;

        pub fn cuMemHostGetDevicePointer_v2(
            pdptr: *mut CUdeviceptr,
            p: *mut c_void,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuMemHostGetFlags(pflags: *mut c_uint, p: *mut c_void) -> CUresult;

        pub fn cuMemAllocManaged(
            dptr: *mut CUdeviceptr,
            bytesize: usize,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuDeviceRegisterAsyncNotification(
            device: CUdevice,
            callback_func: CUasyncCallback,
            user_data: *mut c_void,
            callback: *mut CUasyncCallbackHandle,
        ) -> CUresult;

        pub fn cuDeviceUnregisterAsyncNotification(
            device: CUdevice,
            callback: CUasyncCallbackHandle,
        ) -> CUresult;

        pub fn cuDeviceGetByPCIBusId(dev: *mut CUdevice, pci_bus_id: *const c_char) -> CUresult;

        pub fn cuDeviceGetPCIBusId(pci_bus_id: *mut c_char, len: c_int, dev: CUdevice) -> CUresult;

        pub fn cuIpcGetEventHandle(p_handle: *mut CUipcEventHandle, event: CUevent) -> CUresult;

        pub fn cuIpcOpenEventHandle(ph_event: *mut CUevent, handle: CUipcEventHandle) -> CUresult;

        pub fn cuIpcGetMemHandle(p_handle: *mut CUipcMemHandle, dptr: CUdeviceptr) -> CUresult;

        pub fn cuIpcOpenMemHandle_v2(
            pdptr: *mut CUdeviceptr,
            handle: CUipcMemHandle,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuIpcCloseMemHandle(dptr: CUdeviceptr) -> CUresult;

        pub fn cuMemHostRegister_v2(p: *mut c_void, bytesize: usize, flags: c_uint) -> CUresult;

        pub fn cuMemHostUnregister(p: *mut c_void) -> CUresult;

        pub fn cuMemcpy(dst: CUdeviceptr, src: CUdeviceptr, byte_count: usize) -> CUresult;

        pub fn cuMemcpyPeer(
            dst_device: CUdeviceptr,
            dst_context: CUcontext,
            src_device: CUdeviceptr,
            src_context: CUcontext,
            byte_count: usize,
        ) -> CUresult;

        pub fn cuMemcpyHtoD_v2(
            dst_device: CUdeviceptr,
            src_host: *const c_void,
            byte_count: usize,
        ) -> CUresult;

        pub fn cuMemcpyDtoH_v2(
            dst_host: *mut c_void,
            src_device: CUdeviceptr,
            byte_count: usize,
        ) -> CUresult;

        pub fn cuMemcpyDtoD_v2(
            dst_device: CUdeviceptr,
            src_device: CUdeviceptr,
            byte_count: usize,
        ) -> CUresult;

        pub fn cuMemcpyDtoA_v2(
            dst_array: CUarray,
            dst_offset: usize,
            src_device: CUdeviceptr,
            byte_count: usize,
        ) -> CUresult;

        pub fn cuMemcpyAtoD_v2(
            dst_device: CUdeviceptr,
            src_array: CUarray,
            src_offset: usize,
            byte_count: usize,
        ) -> CUresult;

        pub fn cuMemcpyHtoA_v2(
            dst_array: CUarray,
            dst_offset: usize,
            src_host: *const c_void,
            byte_count: usize,
        ) -> CUresult;

        pub fn cuMemcpyAtoH_v2(
            dst_host: *mut c_void,
            src_array: CUarray,
            src_offset: usize,
            byte_count: usize,
        ) -> CUresult;

        pub fn cuMemcpyAtoA_v2(
            dst_array: CUarray,
            dst_offset: usize,
            src_array: CUarray,
            src_offset: usize,
            byte_count: usize,
        ) -> CUresult;

        pub fn cuMemcpy2D_v2(p_copy: *const CUDA_MEMCPY2D) -> CUresult;

        pub fn cuMemcpy2DUnaligned_v2(p_copy: *const CUDA_MEMCPY2D) -> CUresult;

        pub fn cuMemcpy3D_v2(p_copy: *const CUDA_MEMCPY3D) -> CUresult;

        pub fn cuMemcpy3DPeer(p_copy: *const CUDA_MEMCPY3D_PEER) -> CUresult;

        pub fn cuMemcpyAsync(
            dst: CUdeviceptr,
            src: CUdeviceptr,
            byte_count: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemcpyPeerAsync(
            dst_device: CUdeviceptr,
            dst_context: CUcontext,
            src_device: CUdeviceptr,
            src_context: CUcontext,
            byte_count: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemcpyHtoDAsync_v2(
            dst_device: CUdeviceptr,
            src_host: *const c_void,
            byte_count: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemcpyDtoHAsync_v2(
            dst_host: *mut c_void,
            src_device: CUdeviceptr,
            byte_count: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemcpyDtoDAsync_v2(
            dst_device: CUdeviceptr,
            src_device: CUdeviceptr,
            byte_count: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemcpyHtoAAsync_v2(
            dst_array: CUarray,
            dst_offset: usize,
            src_host: *const c_void,
            byte_count: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemcpyAtoHAsync_v2(
            dst_host: *mut c_void,
            src_array: CUarray,
            src_offset: usize,
            byte_count: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemcpy2DAsync_v2(p_copy: *const CUDA_MEMCPY2D, h_stream: CUstream) -> CUresult;

        pub fn cuMemcpy3DAsync_v2(p_copy: *const CUDA_MEMCPY3D, h_stream: CUstream) -> CUresult;

        pub fn cuMemcpy3DPeerAsync(
            p_copy: *const CUDA_MEMCPY3D_PEER,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemsetD8_v2(dst_device: CUdeviceptr, uc: c_uchar, n: usize) -> CUresult;

        pub fn cuMemsetD16_v2(dst_device: CUdeviceptr, us: c_ushort, n: usize) -> CUresult;

        pub fn cuMemsetD32_v2(dst_device: CUdeviceptr, ui: c_uint, n: usize) -> CUresult;

        pub fn cuMemsetD2D8_v2(
            dst_device: CUdeviceptr,
            dst_pitch: usize,
            uc: c_uchar,
            width: usize,
            height: usize,
        ) -> CUresult;

        pub fn cuMemsetD2D16_v2(
            dst_device: CUdeviceptr,
            dst_pitch: usize,
            us: c_ushort,
            width: usize,
            height: usize,
        ) -> CUresult;

        pub fn cuMemsetD2D32_v2(
            dst_device: CUdeviceptr,
            dst_pitch: usize,
            ui: c_uint,
            width: usize,
            height: usize,
        ) -> CUresult;

        pub fn cuMemsetD8Async(
            dst_device: CUdeviceptr,
            uc: c_uchar,
            n: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemsetD16Async(
            dst_device: CUdeviceptr,
            us: c_ushort,
            n: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemsetD32Async(
            dst_device: CUdeviceptr,
            ui: c_uint,
            n: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemsetD2D8Async(
            dst_device: CUdeviceptr,
            dst_pitch: usize,
            uc: c_uchar,
            width: usize,
            height: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemsetD2D16Async(
            dst_device: CUdeviceptr,
            dst_pitch: usize,
            us: c_ushort,
            width: usize,
            height: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemsetD2D32Async(
            dst_device: CUdeviceptr,
            dst_pitch: usize,
            ui: c_uint,
            width: usize,
            height: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuArrayCreate_v2(
            p_handle: *mut CUarray,
            p_allocate_array: *const CUDA_ARRAY_DESCRIPTOR,
        ) -> CUresult;

        pub fn cuArrayGetDescriptor_v2(
            p_array_descriptor: *mut CUDA_ARRAY_DESCRIPTOR,
            h_array: CUarray,
        ) -> CUresult;

        pub fn cuArrayGetSparseProperties(
            sparse_properties: *mut CUDA_ARRAY_SPARSE_PROPERTIES,
            array: CUarray,
        ) -> CUresult;

        pub fn cuMipmappedArrayGetSparseProperties(
            sparse_properties: *mut CUDA_ARRAY_SPARSE_PROPERTIES,
            mipmap: CUmipmappedArray,
        ) -> CUresult;

        pub fn cuArrayGetMemoryRequirements(
            memory_requirements: *mut CUDA_ARRAY_MEMORY_REQUIREMENTS,
            array: CUarray,
            device: CUdevice,
        ) -> CUresult;

        pub fn cuMipmappedArrayGetMemoryRequirements(
            memory_requirements: *mut CUDA_ARRAY_MEMORY_REQUIREMENTS,
            mipmap: CUmipmappedArray,
            device: CUdevice,
        ) -> CUresult;

        pub fn cuArrayGetPlane(
            p_plane_array: *mut CUarray,
            h_array: CUarray,
            plane_idx: c_uint,
        ) -> CUresult;

        pub fn cuArrayDestroy(h_array: CUarray) -> CUresult;

        pub fn cuArray3DCreate_v2(
            p_handle: *mut CUarray,
            p_allocate_array: *const CUDA_ARRAY3D_DESCRIPTOR,
        ) -> CUresult;

        pub fn cuArray3DGetDescriptor_v2(
            p_array_descriptor: *mut CUDA_ARRAY3D_DESCRIPTOR,
            h_array: CUarray,
        ) -> CUresult;

        pub fn cuMipmappedArrayCreate(
            p_handle: *mut CUmipmappedArray,
            p_mipmapped_array_desc: *const CUDA_ARRAY3D_DESCRIPTOR,
            num_mipmap_levels: c_uint,
        ) -> CUresult;

        pub fn cuMipmappedArrayGetLevel(
            p_level_array: *mut CUarray,
            h_mipmapped_array: CUmipmappedArray,
            level: c_uint,
        ) -> CUresult;

        pub fn cuMipmappedArrayDestroy(h_mipmapped_array: CUmipmappedArray) -> CUresult;

        pub fn cuMemGetHandleForAddressRange(
            handle: *mut c_void,
            dptr: CUdeviceptr,
            size: usize,
            handle_type: CUmemRangeHandleType,
            flags: c_ulonglong,
        ) -> CUresult;

        pub fn cuMemAddressReserve(
            ptr: *mut CUdeviceptr,
            size: usize,
            alignment: usize,
            addr: CUdeviceptr,
            flags: c_ulonglong,
        ) -> CUresult;

        pub fn cuMemAddressFree(ptr: CUdeviceptr, size: usize) -> CUresult;

        pub fn cuMemCreate(
            handle: *mut CUmemGenericAllocationHandle,
            size: usize,
            prop: *const CUmemAllocationProp,
            flags: c_ulonglong,
        ) -> CUresult;

        pub fn cuMemRelease(handle: CUmemGenericAllocationHandle) -> CUresult;

        pub fn cuMemMap(
            ptr: CUdeviceptr,
            size: usize,
            offset: usize,
            handle: CUmemGenericAllocationHandle,
            flags: c_ulonglong,
        ) -> CUresult;

        pub fn cuMemMapArrayAsync(
            map_info_list: *mut CUarrayMapInfo,
            count: c_uint,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemUnmap(ptr: CUdeviceptr, size: usize) -> CUresult;

        pub fn cuMemSetAccess(
            ptr: CUdeviceptr,
            size: usize,
            desc: *const CUmemAccessDesc,
            count: usize,
        ) -> CUresult;

        pub fn cuMemGetAccess(
            flags: *mut c_ulonglong,
            location: *const CUmemLocation,
            ptr: CUdeviceptr,
        ) -> CUresult;

        pub fn cuMemExportToShareableHandle(
            shareable_handle: *mut c_void,
            handle: CUmemGenericAllocationHandle,
            handle_type: CUmemAllocationHandleType,
            flags: c_ulonglong,
        ) -> CUresult;

        pub fn cuMemImportFromShareableHandle(
            handle: *mut CUmemGenericAllocationHandle,
            os_handle: *mut c_void,
            sh_handle_type: CUmemAllocationHandleType,
        ) -> CUresult;

        pub fn cuMemGetAllocationGranularity(
            granularity: *mut usize,
            prop: *const CUmemAllocationProp,
            option: CUmemAllocationGranularity_flags,
        ) -> CUresult;

        pub fn cuMemGetAllocationPropertiesFromHandle(
            prop: *mut CUmemAllocationProp,
            handle: CUmemGenericAllocationHandle,
        ) -> CUresult;

        pub fn cuMemRetainAllocationHandle(
            handle: *mut CUmemGenericAllocationHandle,
            addr: *mut c_void,
        ) -> CUresult;

        pub fn cuMemFreeAsync(dptr: CUdeviceptr, h_stream: CUstream) -> CUresult;

        pub fn cuMemAllocAsync(
            dptr: *mut CUdeviceptr,
            bytesize: usize,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemPoolTrimTo(pool: CUmemoryPool, min_bytes_to_keep: usize) -> CUresult;

        pub fn cuMemPoolSetAttribute(
            pool: CUmemoryPool,
            attr: CUmemPool_attribute,
            value: *mut c_void,
        ) -> CUresult;

        pub fn cuMemPoolGetAttribute(
            pool: CUmemoryPool,
            attr: CUmemPool_attribute,
            value: *mut c_void,
        ) -> CUresult;

        pub fn cuMemPoolSetAccess(
            pool: CUmemoryPool,
            map: *const CUmemAccessDesc,
            count: usize,
        ) -> CUresult;

        pub fn cuMemPoolGetAccess(
            flags: *mut CUmemAccess_flags,
            mem_pool: CUmemoryPool,
            location: *mut CUmemLocation,
        ) -> CUresult;

        pub fn cuMemPoolCreate(
            pool: *mut CUmemoryPool,
            pool_props: *const CUmemPoolProps,
        ) -> CUresult;

        pub fn cuMemPoolDestroy(pool: CUmemoryPool) -> CUresult;

        pub fn cuMemAllocFromPoolAsync(
            dptr: *mut CUdeviceptr,
            bytesize: usize,
            pool: CUmemoryPool,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemPoolExportToShareableHandle(
            handle_out: *mut c_void,
            pool: CUmemoryPool,
            handle_type: CUmemAllocationHandleType,
            flags: c_ulonglong,
        ) -> CUresult;

        pub fn cuMemPoolImportFromShareableHandle(
            pool_out: *mut CUmemoryPool,
            handle: *mut c_void,
            handle_type: CUmemAllocationHandleType,
            flags: c_ulonglong,
        ) -> CUresult;

        pub fn cuMemPoolExportPointer(
            share_data_out: *mut CUmemPoolPtrExportData,
            ptr: CUdeviceptr,
        ) -> CUresult;

        pub fn cuMemPoolImportPointer(
            ptr_out: *mut CUdeviceptr,
            pool: CUmemoryPool,
            share_data: *mut CUmemPoolPtrExportData,
        ) -> CUresult;

        pub fn cuMulticastCreate(
            mc_handle: *mut CUmemGenericAllocationHandle,
            prop: *const CUmulticastObjectProp,
        ) -> CUresult;

        pub fn cuMulticastAddDevice(
            mc_handle: CUmemGenericAllocationHandle,
            dev: CUdevice,
        ) -> CUresult;

        pub fn cuMulticastBindMem(
            mc_handle: CUmemGenericAllocationHandle,
            mc_offset: usize,
            mem_handle: CUmemGenericAllocationHandle,
            mem_offset: usize,
            size: usize,
            flags: c_ulonglong,
        ) -> CUresult;

        pub fn cuMulticastBindAddr(
            mc_handle: CUmemGenericAllocationHandle,
            mc_offset: usize,
            memptr: CUdeviceptr,
            size: usize,
            flags: c_ulonglong,
        ) -> CUresult;

        pub fn cuMulticastUnbind(
            mc_handle: CUmemGenericAllocationHandle,
            dev: CUdevice,
            mc_offset: usize,
            size: usize,
        ) -> CUresult;

        pub fn cuMulticastGetGranularity(
            granularity: *mut usize,
            prop: *const CUmulticastObjectProp,
            option: CUmulticastGranularity_flags,
        ) -> CUresult;

        pub fn cuPointerGetAttribute(
            data: *mut c_void,
            attribute: CUpointer_attribute,
            ptr: CUdeviceptr,
        ) -> CUresult;

        pub fn cuMemPrefetchAsync(
            dev_ptr: CUdeviceptr,
            count: usize,
            dst_device: CUdevice,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemPrefetchAsync_v2(
            dev_ptr: CUdeviceptr,
            count: usize,
            location: CUmemLocation,
            flags: c_uint,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuMemAdvise(
            dev_ptr: CUdeviceptr,
            count: usize,
            advice: CUmem_advise,
            device: CUdevice,
        ) -> CUresult;

        pub fn cuMemAdvise_v2(
            dev_ptr: CUdeviceptr,
            count: usize,
            advice: CUmem_advise,
            location: CUmemLocation,
        ) -> CUresult;

        pub fn cuMemRangeGetAttribute(
            data: *mut c_void,
            data_size: usize,
            attribute: CUmem_range_attribute,
            dev_ptr: CUdeviceptr,
            count: usize,
        ) -> CUresult;

        pub fn cuMemRangeGetAttributes(
            data: *mut *mut c_void,
            data_sizes: *mut usize,
            attributes: *mut CUmem_range_attribute,
            num_attributes: usize,
            dev_ptr: CUdeviceptr,
            count: usize,
        ) -> CUresult;

        pub fn cuPointerSetAttribute(
            value: *const c_void,
            attribute: CUpointer_attribute,
            ptr: CUdeviceptr,
        ) -> CUresult;

        pub fn cuPointerGetAttributes(
            num_attributes: c_uint,
            attributes: *mut CUpointer_attribute,
            data: *mut *mut c_void,
            ptr: CUdeviceptr,
        ) -> CUresult;

        pub fn cuStreamCreate(ph_stream: *mut CUstream, flags: c_uint) -> CUresult;

        pub fn cuStreamCreateWithPriority(
            ph_stream: *mut CUstream,
            flags: c_uint,
            priority: c_int,
        ) -> CUresult;

        pub fn cuStreamGetPriority(h_stream: CUstream, priority: *mut c_int) -> CUresult;

        pub fn cuStreamGetFlags(h_stream: CUstream, flags: *mut c_uint) -> CUresult;

        pub fn cuStreamGetId(h_stream: CUstream, stream_id: *mut c_ulonglong) -> CUresult;

        pub fn cuStreamGetCtx(h_stream: CUstream, p_ctx: *mut CUcontext) -> CUresult;

        pub fn cuStreamWaitEvent(h_stream: CUstream, h_event: CUevent, flags: c_uint) -> CUresult;

        pub fn cuStreamAddCallback(
            h_stream: CUstream,
            callback: CUstreamCallback,
            user_data: *mut c_void,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuStreamBeginCapture_v2(h_stream: CUstream, mode: CUstreamCaptureMode) -> CUresult;

        pub fn cuStreamBeginCaptureToGraph(
            h_stream: CUstream,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            dependency_data: *const CUgraphEdgeData,
            num_dependencies: usize,
            mode: CUstreamCaptureMode,
        ) -> CUresult;

        pub fn cuThreadExchangeStreamCaptureMode(mode: *mut CUstreamCaptureMode) -> CUresult;

        pub fn cuStreamEndCapture(h_stream: CUstream, ph_graph: *mut CUgraph) -> CUresult;

        pub fn cuStreamIsCapturing(
            h_stream: CUstream,
            capture_status: *mut CUstreamCaptureStatus,
        ) -> CUresult;

        pub fn cuStreamGetCaptureInfo_v2(
            h_stream: CUstream,
            capture_status_out: *mut CUstreamCaptureStatus,
            id_out: *mut cuuint64_t,
            graph_out: *mut CUgraph,
            dependencies_out: *mut *const CUgraphNode,
            num_dependencies_out: *mut usize,
        ) -> CUresult;

        pub fn cuStreamGetCaptureInfo_v3(
            h_stream: CUstream,
            capture_status_out: *mut CUstreamCaptureStatus,
            id_out: *mut cuuint64_t,
            graph_out: *mut CUgraph,
            dependencies_out: *mut *const CUgraphNode,
            edge_data_out: *mut *const CUgraphEdgeData,
            num_dependencies_out: *mut usize,
        ) -> CUresult;

        pub fn cuStreamUpdateCaptureDependencies(
            h_stream: CUstream,
            dependencies: *mut CUgraphNode,
            num_dependencies: usize,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuStreamUpdateCaptureDependencies_v2(
            h_stream: CUstream,
            dependencies: *mut CUgraphNode,
            dependency_data: *const CUgraphEdgeData,
            num_dependencies: usize,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuStreamAttachMemAsync(
            h_stream: CUstream,
            dptr: CUdeviceptr,
            length: usize,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuStreamQuery(h_stream: CUstream) -> CUresult;

        pub fn cuStreamSynchronize(h_stream: CUstream) -> CUresult;

        pub fn cuStreamDestroy_v2(h_stream: CUstream) -> CUresult;

        pub fn cuStreamCopyAttributes(dst: CUstream, src: CUstream) -> CUresult;

        pub fn cuStreamGetAttribute(
            h_stream: CUstream,
            attr: CUstreamAttrID,
            value_out: *mut CUstreamAttrValue,
        ) -> CUresult;

        pub fn cuStreamSetAttribute(
            h_stream: CUstream,
            attr: CUstreamAttrID,
            value: *const CUstreamAttrValue,
        ) -> CUresult;

        pub fn cuEventCreate(ph_event: *mut CUevent, flags: c_uint) -> CUresult;

        pub fn cuEventRecord(h_event: CUevent, h_stream: CUstream) -> CUresult;

        pub fn cuEventRecordWithFlags(
            h_event: CUevent,
            h_stream: CUstream,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuEventQuery(h_event: CUevent) -> CUresult;

        pub fn cuEventSynchronize(h_event: CUevent) -> CUresult;

        pub fn cuEventDestroy_v2(h_event: CUevent) -> CUresult;

        pub fn cuEventElapsedTime(
            p_milliseconds: *mut f32,
            h_start: CUevent,
            h_end: CUevent,
        ) -> CUresult;

        pub fn cuImportExternalMemory(
            ext_mem_out: *mut CUexternalMemory,
            mem_handle_desc: *const CUDA_EXTERNAL_MEMORY_HANDLE_DESC,
        ) -> CUresult;

        pub fn cuExternalMemoryGetMappedBuffer(
            dev_ptr: *mut CUdeviceptr,
            ext_mem: CUexternalMemory,
            buffer_desc: *const CUDA_EXTERNAL_MEMORY_BUFFER_DESC,
        ) -> CUresult;

        pub fn cuExternalMemoryGetMappedMipmappedArray(
            mipmap: *mut CUmipmappedArray,
            ext_mem: CUexternalMemory,
            mipmap_desc: *const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC,
        ) -> CUresult;

        pub fn cuDestroyExternalMemory(ext_mem: CUexternalMemory) -> CUresult;

        pub fn cuImportExternalSemaphore(
            ext_sem_out: *mut CUexternalSemaphore,
            sem_handle_desc: *const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC,
        ) -> CUresult;

        pub fn cuSignalExternalSemaphoresAsync(
            ext_sem_array: *const CUexternalSemaphore,
            params_array: *const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS,
            num_ext_sems: c_uint,
            stream: CUstream,
        ) -> CUresult;

        pub fn cuWaitExternalSemaphoresAsync(
            ext_sem_array: *const CUexternalSemaphore,
            params_array: *const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS,
            num_ext_sems: c_uint,
            stream: CUstream,
        ) -> CUresult;

        pub fn cuDestroyExternalSemaphore(ext_sem: CUexternalSemaphore) -> CUresult;

        pub fn cuStreamWaitValue32_v2(
            stream: CUstream,
            addr: CUdeviceptr,
            value: cuuint32_t,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuStreamWaitValue64_v2(
            stream: CUstream,
            addr: CUdeviceptr,
            value: cuuint64_t,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuStreamWriteValue32_v2(
            stream: CUstream,
            addr: CUdeviceptr,
            value: cuuint32_t,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuStreamWriteValue64_v2(
            stream: CUstream,
            addr: CUdeviceptr,
            value: cuuint64_t,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuStreamBatchMemOp_v2(
            stream: CUstream,
            count: c_uint,
            param_array: *mut CUstreamBatchMemOpParams,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuFuncGetAttribute(
            pi: *mut c_int,
            attrib: CUfunction_attribute,
            hfunc: CUfunction,
        ) -> CUresult;

        pub fn cuFuncSetAttribute(
            hfunc: CUfunction,
            attrib: CUfunction_attribute,
            value: c_int,
        ) -> CUresult;

        pub fn cuFuncSetCacheConfig(hfunc: CUfunction, config: CUfunc_cache) -> CUresult;

        pub fn cuFuncGetModule(hmod: *mut CUmodule, hfunc: CUfunction) -> CUresult;

        pub fn cuFuncGetName(name: *mut *const c_char, hfunc: CUfunction) -> CUresult;

        pub fn cuFuncGetParamInfo(
            func: CUfunction,
            param_index: usize,
            param_offset: *mut usize,
            param_size: *mut usize,
        ) -> CUresult;

        pub fn cuFuncIsLoaded(state: *mut CUfunctionLoadingState, function: CUfunction)
            -> CUresult;

        pub fn cuFuncLoad(function: CUfunction) -> CUresult;

        pub fn cuLaunchKernel(
            f: CUfunction,
            grid_dim_x: c_uint,
            grid_dim_y: c_uint,
            grid_dim_z: c_uint,
            block_dim_x: c_uint,
            block_dim_y: c_uint,
            block_dim_z: c_uint,
            shared_mem_bytes: c_uint,
            h_stream: CUstream,
            kernel_params: *mut *mut c_void,
            extra: *mut *mut c_void,
        ) -> CUresult;

        pub fn cuLaunchKernelEx(
            config: *const CUlaunchConfig,
            f: CUfunction,
            kernel_params: *mut *mut c_void,
            extra: *mut *mut c_void,
        ) -> CUresult;

        pub fn cuLaunchCooperativeKernel(
            f: CUfunction,
            grid_dim_x: c_uint,
            grid_dim_y: c_uint,
            grid_dim_z: c_uint,
            block_dim_x: c_uint,
            block_dim_y: c_uint,
            block_dim_z: c_uint,
            shared_mem_bytes: c_uint,
            h_stream: CUstream,
            kernel_params: *mut *mut c_void,
        ) -> CUresult;

        pub fn cuLaunchCooperativeKernelMultiDevice(
            launch_params_list: *mut CUDA_LAUNCH_PARAMS,
            num_devices: c_uint,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuLaunchHostFunc(
            h_stream: CUstream,
            fn_: CUhostFn,
            user_data: *mut c_void,
        ) -> CUresult;

        pub fn cuFuncSetBlockShape(hfunc: CUfunction, x: c_int, y: c_int, z: c_int) -> CUresult;

        pub fn cuFuncSetSharedSize(hfunc: CUfunction, bytes: c_uint) -> CUresult;

        pub fn cuParamSetSize(hfunc: CUfunction, numbytes: c_uint) -> CUresult;

        pub fn cuParamSeti(hfunc: CUfunction, offset: c_int, value: c_uint) -> CUresult;

        pub fn cuParamSetf(hfunc: CUfunction, offset: c_int, value: f32) -> CUresult;

        pub fn cuParamSetv(
            hfunc: CUfunction,
            offset: c_int,
            ptr: *mut c_void,
            numbytes: c_uint,
        ) -> CUresult;

        pub fn cuLaunch(f: CUfunction) -> CUresult;

        pub fn cuLaunchGrid(f: CUfunction, grid_width: c_int, grid_height: c_int) -> CUresult;

        pub fn cuLaunchGridAsync(
            f: CUfunction,
            grid_width: c_int,
            grid_height: c_int,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuParamSetTexRef(hfunc: CUfunction, texunit: c_int, h_tex_ref: CUtexref)
            -> CUresult;

        pub fn cuFuncSetSharedMemConfig(hfunc: CUfunction, config: CUsharedconfig) -> CUresult;

        pub fn cuGraphCreate(ph_graph: *mut CUgraph, flags: c_uint) -> CUresult;

        pub fn cuGraphAddKernelNode_v2(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
            node_params: *const CUDA_KERNEL_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphKernelNodeGetParams_v2(
            h_node: CUgraphNode,
            node_params: *mut CUDA_KERNEL_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphKernelNodeSetParams_v2(
            h_node: CUgraphNode,
            node_params: *const CUDA_KERNEL_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphAddMemcpyNode(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
            copy_params: *const CUDA_MEMCPY3D,
            ctx: CUcontext,
        ) -> CUresult;

        pub fn cuGraphMemcpyNodeGetParams(
            h_node: CUgraphNode,
            node_params: *mut CUDA_MEMCPY3D,
        ) -> CUresult;

        pub fn cuGraphMemcpyNodeSetParams(
            h_node: CUgraphNode,
            node_params: *const CUDA_MEMCPY3D,
        ) -> CUresult;

        pub fn cuGraphAddMemsetNode(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
            memset_params: *const CUDA_MEMSET_NODE_PARAMS,
            ctx: CUcontext,
        ) -> CUresult;

        pub fn cuGraphMemsetNodeGetParams(
            h_node: CUgraphNode,
            node_params: *mut CUDA_MEMSET_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphMemsetNodeSetParams(
            h_node: CUgraphNode,
            node_params: *const CUDA_MEMSET_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphAddHostNode(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
            node_params: *const CUDA_HOST_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphHostNodeGetParams(
            h_node: CUgraphNode,
            node_params: *mut CUDA_HOST_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphHostNodeSetParams(
            h_node: CUgraphNode,
            node_params: *const CUDA_HOST_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphAddChildGraphNode(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
            child_graph: CUgraph,
        ) -> CUresult;

        pub fn cuGraphChildGraphNodeGetGraph(
            h_node: CUgraphNode,
            ph_graph: *mut CUgraph,
        ) -> CUresult;

        pub fn cuGraphAddEmptyNode(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
        ) -> CUresult;

        pub fn cuGraphAddEventRecordNode(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
            event: CUevent,
        ) -> CUresult;

        pub fn cuGraphEventRecordNodeGetEvent(
            h_node: CUgraphNode,
            event_out: *mut CUevent,
        ) -> CUresult;

        pub fn cuGraphEventRecordNodeSetEvent(h_node: CUgraphNode, event: CUevent) -> CUresult;

        pub fn cuGraphAddEventWaitNode(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
            event: CUevent,
        ) -> CUresult;

        pub fn cuGraphEventWaitNodeGetEvent(
            h_node: CUgraphNode,
            event_out: *mut CUevent,
        ) -> CUresult;

        pub fn cuGraphEventWaitNodeSetEvent(h_node: CUgraphNode, event: CUevent) -> CUresult;

        pub fn cuGraphAddExternalSemaphoresSignalNode(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
            node_params: *const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphExternalSemaphoresSignalNodeGetParams(
            h_node: CUgraphNode,
            params_out: *mut CUDA_EXT_SEM_SIGNAL_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphExternalSemaphoresSignalNodeSetParams(
            h_node: CUgraphNode,
            node_params: *const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphAddExternalSemaphoresWaitNode(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
            node_params: *const CUDA_EXT_SEM_WAIT_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphExternalSemaphoresWaitNodeGetParams(
            h_node: CUgraphNode,
            params_out: *mut CUDA_EXT_SEM_WAIT_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphExternalSemaphoresWaitNodeSetParams(
            h_node: CUgraphNode,
            node_params: *const CUDA_EXT_SEM_WAIT_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphAddBatchMemOpNode(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
            node_params: *const CUDA_BATCH_MEM_OP_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphBatchMemOpNodeGetParams(
            h_node: CUgraphNode,
            node_params_out: *mut CUDA_BATCH_MEM_OP_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphBatchMemOpNodeSetParams(
            h_node: CUgraphNode,
            node_params: *const CUDA_BATCH_MEM_OP_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphExecBatchMemOpNodeSetParams(
            h_graph_exec: CUgraphExec,
            h_node: CUgraphNode,
            node_params: *const CUDA_BATCH_MEM_OP_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphAddMemAllocNode(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
            node_params: *mut CUDA_MEM_ALLOC_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphMemAllocNodeGetParams(
            h_node: CUgraphNode,
            params_out: *mut CUDA_MEM_ALLOC_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphAddMemFreeNode(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
            dptr: CUdeviceptr,
        ) -> CUresult;

        pub fn cuGraphMemFreeNodeGetParams(
            h_node: CUgraphNode,
            dptr_out: *mut CUdeviceptr,
        ) -> CUresult;

        pub fn cuDeviceGraphMemTrim(device: CUdevice) -> CUresult;

        pub fn cuDeviceGetGraphMemAttribute(
            device: CUdevice,
            attr: CUgraphMem_attribute,
            value: *mut c_void,
        ) -> CUresult;

        pub fn cuDeviceSetGraphMemAttribute(
            device: CUdevice,
            attr: CUgraphMem_attribute,
            value: *mut c_void,
        ) -> CUresult;

        pub fn cuGraphClone(ph_graph_clone: *mut CUgraph, original_graph: CUgraph) -> CUresult;

        pub fn cuGraphNodeFindInClone(
            ph_node: *mut CUgraphNode,
            h_original_node: CUgraphNode,
            h_cloned_graph: CUgraph,
        ) -> CUresult;

        pub fn cuGraphNodeGetType(h_node: CUgraphNode, type_: *mut CUgraphNodeType) -> CUresult;

        pub fn cuGraphGetNodes(
            h_graph: CUgraph,
            nodes: *mut CUgraphNode,
            num_nodes: *mut usize,
        ) -> CUresult;

        pub fn cuGraphGetRootNodes(
            h_graph: CUgraph,
            root_nodes: *mut CUgraphNode,
            num_root_nodes: *mut usize,
        ) -> CUresult;

        pub fn cuGraphGetEdges(
            h_graph: CUgraph,
            from: *mut CUgraphNode,
            to: *mut CUgraphNode,
            num_edges: *mut usize,
        ) -> CUresult;

        pub fn cuGraphGetEdges_v2(
            h_graph: CUgraph,
            from: *mut CUgraphNode,
            to: *mut CUgraphNode,
            edge_data: *mut CUgraphEdgeData,
            num_edges: *mut usize,
        ) -> CUresult;

        pub fn cuGraphNodeGetDependencies(
            h_node: CUgraphNode,
            dependencies: *mut CUgraphNode,
            num_dependencies: *mut usize,
        ) -> CUresult;

        pub fn cuGraphNodeGetDependencies_v2(
            h_node: CUgraphNode,
            dependencies: *mut CUgraphNode,
            edge_data: *mut CUgraphEdgeData,
            num_dependencies: *mut usize,
        ) -> CUresult;

        pub fn cuGraphNodeGetDependentNodes(
            h_node: CUgraphNode,
            dependent_nodes: *mut CUgraphNode,
            num_dependent_nodes: *mut usize,
        ) -> CUresult;

        pub fn cuGraphNodeGetDependentNodes_v2(
            h_node: CUgraphNode,
            dependent_nodes: *mut CUgraphNode,
            edge_data: *mut CUgraphEdgeData,
            num_dependent_nodes: *mut usize,
        ) -> CUresult;

        pub fn cuGraphAddDependencies(
            h_graph: CUgraph,
            from: *const CUgraphNode,
            to: *const CUgraphNode,
            num_dependencies: usize,
        ) -> CUresult;

        pub fn cuGraphAddDependencies_v2(
            h_graph: CUgraph,
            from: *const CUgraphNode,
            to: *const CUgraphNode,
            edge_data: *const CUgraphEdgeData,
            num_dependencies: usize,
        ) -> CUresult;

        pub fn cuGraphRemoveDependencies(
            h_graph: CUgraph,
            from: *const CUgraphNode,
            to: *const CUgraphNode,
            num_dependencies: usize,
        ) -> CUresult;

        pub fn cuGraphRemoveDependencies_v2(
            h_graph: CUgraph,
            from: *const CUgraphNode,
            to: *const CUgraphNode,
            edge_data: *const CUgraphEdgeData,
            num_dependencies: usize,
        ) -> CUresult;

        pub fn cuGraphDestroyNode(h_node: CUgraphNode) -> CUresult;

        pub fn cuGraphInstantiateWithFlags(
            ph_graph_exec: *mut CUgraphExec,
            h_graph: CUgraph,
            flags: c_ulonglong,
        ) -> CUresult;

        pub fn cuGraphInstantiateWithParams(
            ph_graph_exec: *mut CUgraphExec,
            h_graph: CUgraph,
            instantiate_params: *mut CUDA_GRAPH_INSTANTIATE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphExecGetFlags(h_graph_exec: CUgraphExec, flags: *mut cuuint64_t) -> CUresult;

        pub fn cuGraphExecKernelNodeSetParams_v2(
            h_graph_exec: CUgraphExec,
            h_node: CUgraphNode,
            node_params: *const CUDA_KERNEL_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphExecMemcpyNodeSetParams(
            h_graph_exec: CUgraphExec,
            h_node: CUgraphNode,
            copy_params: *const CUDA_MEMCPY3D,
            ctx: CUcontext,
        ) -> CUresult;

        pub fn cuGraphExecMemsetNodeSetParams(
            h_graph_exec: CUgraphExec,
            h_node: CUgraphNode,
            memset_params: *const CUDA_MEMSET_NODE_PARAMS,
            ctx: CUcontext,
        ) -> CUresult;

        pub fn cuGraphExecHostNodeSetParams(
            h_graph_exec: CUgraphExec,
            h_node: CUgraphNode,
            node_params: *const CUDA_HOST_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphExecChildGraphNodeSetParams(
            h_graph_exec: CUgraphExec,
            h_node: CUgraphNode,
            child_graph: CUgraph,
        ) -> CUresult;

        pub fn cuGraphExecEventRecordNodeSetEvent(
            h_graph_exec: CUgraphExec,
            h_node: CUgraphNode,
            event: CUevent,
        ) -> CUresult;

        pub fn cuGraphExecEventWaitNodeSetEvent(
            h_graph_exec: CUgraphExec,
            h_node: CUgraphNode,
            event: CUevent,
        ) -> CUresult;

        pub fn cuGraphExecExternalSemaphoresSignalNodeSetParams(
            h_graph_exec: CUgraphExec,
            h_node: CUgraphNode,
            node_params: *const CUDA_EXT_SEM_SIGNAL_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphExecExternalSemaphoresWaitNodeSetParams(
            h_graph_exec: CUgraphExec,
            h_node: CUgraphNode,
            node_params: *const CUDA_EXT_SEM_WAIT_NODE_PARAMS,
        ) -> CUresult;

        pub fn cuGraphNodeSetEnabled(
            h_graph_exec: CUgraphExec,
            h_node: CUgraphNode,
            is_enabled: c_uint,
        ) -> CUresult;

        pub fn cuGraphNodeGetEnabled(
            h_graph_exec: CUgraphExec,
            h_node: CUgraphNode,
            is_enabled: *mut c_uint,
        ) -> CUresult;

        pub fn cuGraphUpload(h_graph_exec: CUgraphExec, h_stream: CUstream) -> CUresult;

        pub fn cuGraphLaunch(h_graph_exec: CUgraphExec, h_stream: CUstream) -> CUresult;

        pub fn cuGraphExecDestroy(h_graph_exec: CUgraphExec) -> CUresult;

        pub fn cuGraphDestroy(h_graph: CUgraph) -> CUresult;

        pub fn cuGraphExecUpdate_v2(
            h_graph_exec: CUgraphExec,
            h_graph: CUgraph,
            result_info: *mut CUgraphExecUpdateResultInfo,
        ) -> CUresult;

        pub fn cuGraphKernelNodeCopyAttributes(dst: CUgraphNode, src: CUgraphNode) -> CUresult;

        pub fn cuGraphKernelNodeGetAttribute(
            h_node: CUgraphNode,
            attr: CUkernelNodeAttrID,
            value_out: *mut CUkernelNodeAttrValue,
        ) -> CUresult;

        pub fn cuGraphKernelNodeSetAttribute(
            h_node: CUgraphNode,
            attr: CUkernelNodeAttrID,
            value: *const CUkernelNodeAttrValue,
        ) -> CUresult;

        pub fn cuGraphDebugDotPrint(
            h_graph: CUgraph,
            path: *const c_char,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuUserObjectCreate(
            object_out: *mut CUuserObject,
            ptr: *mut c_void,
            destroy: CUhostFn,
            initial_refcount: c_uint,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuUserObjectRetain(object: CUuserObject, count: c_uint) -> CUresult;

        pub fn cuUserObjectRelease(object: CUuserObject, count: c_uint) -> CUresult;

        pub fn cuGraphRetainUserObject(
            graph: CUgraph,
            object: CUuserObject,
            count: c_uint,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuGraphReleaseUserObject(
            graph: CUgraph,
            object: CUuserObject,
            count: c_uint,
        ) -> CUresult;

        pub fn cuGraphAddNode(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            num_dependencies: usize,
            node_params: *mut CUgraphNodeParams,
        ) -> CUresult;

        pub fn cuGraphAddNode_v2(
            ph_graph_node: *mut CUgraphNode,
            h_graph: CUgraph,
            dependencies: *const CUgraphNode,
            dependency_data: *const CUgraphEdgeData,
            num_dependencies: usize,
            node_params: *mut CUgraphNodeParams,
        ) -> CUresult;

        pub fn cuGraphNodeSetParams(
            h_node: CUgraphNode,
            node_params: *mut CUgraphNodeParams,
        ) -> CUresult;

        pub fn cuGraphExecNodeSetParams(
            h_graph_exec: CUgraphExec,
            h_node: CUgraphNode,
            node_params: *mut CUgraphNodeParams,
        ) -> CUresult;

        pub fn cuGraphConditionalHandleCreate(
            p_handle_out: *mut CUgraphConditionalHandle,
            h_graph: CUgraph,
            ctx: CUcontext,
            default_launch_value: c_uint,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuOccupancyMaxActiveBlocksPerMultiprocessor(
            num_blocks: *mut c_int,
            func: CUfunction,
            block_size: c_int,
            dynamic_smem_size: usize,
        ) -> CUresult;

        pub fn cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(
            num_blocks: *mut c_int,
            func: CUfunction,
            block_size: c_int,
            dynamic_smem_size: usize,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuOccupancyMaxPotentialBlockSize(
            min_grid_size: *mut c_int,
            block_size: *mut c_int,
            func: CUfunction,
            block_size_to_dynamic_smem_size: CUoccupancyB2DSize,
            dynamic_smem_size: usize,
            block_size_limit: c_int,
        ) -> CUresult;

        pub fn cuOccupancyMaxPotentialBlockSizeWithFlags(
            min_grid_size: *mut c_int,
            block_size: *mut c_int,
            func: CUfunction,
            block_size_to_dynamic_smem_size: CUoccupancyB2DSize,
            dynamic_smem_size: usize,
            block_size_limit: c_int,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuOccupancyAvailableDynamicSMemPerBlock(
            dynamic_smem_size: *mut usize,
            func: CUfunction,
            num_blocks: c_int,
            block_size: c_int,
        ) -> CUresult;

        pub fn cuOccupancyMaxPotentialClusterSize(
            cluster_size: *mut c_int,
            func: CUfunction,
            config: *const CUlaunchConfig,
        ) -> CUresult;

        pub fn cuOccupancyMaxActiveClusters(
            num_clusters: *mut c_int,
            func: CUfunction,
            config: *const CUlaunchConfig,
        ) -> CUresult;

        pub fn cuTexRefSetArray(h_tex_ref: CUtexref, h_array: CUarray, flags: c_uint) -> CUresult;

        pub fn cuTexRefSetMipmappedArray(
            h_tex_ref: CUtexref,
            h_mipmapped_array: CUmipmappedArray,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuTexRefSetAddress_v2(
            byte_offset: *mut usize,
            h_tex_ref: CUtexref,
            dptr: CUdeviceptr,
            bytes: usize,
        ) -> CUresult;

        pub fn cuTexRefSetAddress2D_v3(
            h_tex_ref: CUtexref,
            desc: *const CUDA_ARRAY_DESCRIPTOR,
            dptr: CUdeviceptr,
            pitch: usize,
        ) -> CUresult;

        pub fn cuTexRefSetFormat(
            h_tex_ref: CUtexref,
            fmt: CUarray_format,
            num_packed_components: c_int,
        ) -> CUresult;

        pub fn cuTexRefSetAddressMode(
            h_tex_ref: CUtexref,
            dim: c_int,
            am: CUaddress_mode,
        ) -> CUresult;

        pub fn cuTexRefSetFilterMode(h_tex_ref: CUtexref, fm: CUfilter_mode) -> CUresult;

        pub fn cuTexRefSetMipmapFilterMode(h_tex_ref: CUtexref, fm: CUfilter_mode) -> CUresult;

        pub fn cuTexRefSetMipmapLevelBias(h_tex_ref: CUtexref, bias: f32) -> CUresult;

        pub fn cuTexRefSetMipmapLevelClamp(
            h_tex_ref: CUtexref,
            min_mipmap_level_clamp: f32,
            max_mipmap_level_clamp: f32,
        ) -> CUresult;

        pub fn cuTexRefSetMaxAnisotropy(h_tex_ref: CUtexref, max_aniso: c_uint) -> CUresult;

        pub fn cuTexRefSetBorderColor(h_tex_ref: CUtexref, p_border_color: *mut f32) -> CUresult;

        pub fn cuTexRefSetFlags(h_tex_ref: CUtexref, flags: c_uint) -> CUresult;

        pub fn cuTexRefGetAddress_v2(pdptr: *mut CUdeviceptr, h_tex_ref: CUtexref) -> CUresult;

        pub fn cuTexRefGetArray(ph_array: *mut CUarray, h_tex_ref: CUtexref) -> CUresult;

        pub fn cuTexRefGetMipmappedArray(
            ph_mipmapped_array: *mut CUmipmappedArray,
            h_tex_ref: CUtexref,
        ) -> CUresult;

        pub fn cuTexRefGetAddressMode(
            pam: *mut CUaddress_mode,
            h_tex_ref: CUtexref,
            dim: c_int,
        ) -> CUresult;

        pub fn cuTexRefGetFilterMode(pfm: *mut CUfilter_mode, h_tex_ref: CUtexref) -> CUresult;

        pub fn cuTexRefGetFormat(
            p_format: *mut CUarray_format,
            pnum_channels: *mut c_int,
            h_tex_ref: CUtexref,
        ) -> CUresult;

        pub fn cuTexRefGetMipmapFilterMode(
            pfm: *mut CUfilter_mode,
            h_tex_ref: CUtexref,
        ) -> CUresult;

        pub fn cuTexRefGetMipmapLevelBias(pbias: *mut f32, h_tex_ref: CUtexref) -> CUresult;

        pub fn cuTexRefGetMipmapLevelClamp(
            p_min_mipmap_level_clamp: *mut f32,
            p_max_mipmap_level_clamp: *mut f32,
            h_tex_ref: CUtexref,
        ) -> CUresult;

        pub fn cuTexRefGetMaxAnisotropy(p_max_aniso: *mut c_int, h_tex_ref: CUtexref) -> CUresult;

        pub fn cuTexRefGetBorderColor(p_border_color: *mut f32, h_tex_ref: CUtexref) -> CUresult;

        pub fn cuTexRefGetFlags(pflags: *mut c_uint, h_tex_ref: CUtexref) -> CUresult;

        pub fn cuTexRefCreate(p_tex_ref: *mut CUtexref) -> CUresult;

        pub fn cuTexRefDestroy(h_tex_ref: CUtexref) -> CUresult;

        pub fn cuSurfRefSetArray(
            h_surf_ref: CUsurfref,
            h_array: CUarray,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuSurfRefGetArray(ph_array: *mut CUarray, h_surf_ref: CUsurfref) -> CUresult;

        pub fn cuTexObjectCreate(
            p_tex_object: *mut CUtexObject,
            p_res_desc: *const CUDA_RESOURCE_DESC,
            p_tex_desc: *const CUDA_TEXTURE_DESC,
            p_res_view_desc: *const CUDA_RESOURCE_VIEW_DESC,
        ) -> CUresult;

        pub fn cuTexObjectDestroy(tex_object: CUtexObject) -> CUresult;

        pub fn cuTexObjectGetResourceDesc(
            p_res_desc: *mut CUDA_RESOURCE_DESC,
            tex_object: CUtexObject,
        ) -> CUresult;

        pub fn cuTexObjectGetTextureDesc(
            p_tex_desc: *mut CUDA_TEXTURE_DESC,
            tex_object: CUtexObject,
        ) -> CUresult;

        pub fn cuTexObjectGetResourceViewDesc(
            p_res_view_desc: *mut CUDA_RESOURCE_VIEW_DESC,
            tex_object: CUtexObject,
        ) -> CUresult;

        pub fn cuSurfObjectCreate(
            p_surf_object: *mut CUsurfObject,
            p_res_desc: *const CUDA_RESOURCE_DESC,
        ) -> CUresult;

        pub fn cuSurfObjectDestroy(surf_object: CUsurfObject) -> CUresult;

        pub fn cuSurfObjectGetResourceDesc(
            p_res_desc: *mut CUDA_RESOURCE_DESC,
            surf_object: CUsurfObject,
        ) -> CUresult;

        pub fn cuTensorMapEncodeTiled(
            tensor_map: *mut CUtensorMap,
            tensor_data_type: CUtensorMapDataType,
            tensor_rank: cuuint32_t,
            global_address: *mut c_void,
            global_dim: *const cuuint64_t,
            global_strides: *const cuuint64_t,
            box_dim: *const cuuint32_t,
            element_strides: *const cuuint32_t,
            interleave: CUtensorMapInterleave,
            swizzle: CUtensorMapSwizzle,
            l2_promotion: CUtensorMapL2promotion,
            oob_fill: CUtensorMapFloatOOBfill,
        ) -> CUresult;

        pub fn cuTensorMapEncodeIm2col(
            tensor_map: *mut CUtensorMap,
            tensor_data_type: CUtensorMapDataType,
            tensor_rank: cuuint32_t,
            global_address: *mut c_void,
            global_dim: *const cuuint64_t,
            global_strides: *const cuuint64_t,
            pixel_box_lower_corner: *const c_int,
            pixel_box_upper_corner: *const c_int,
            channels_per_pixel: cuuint32_t,
            pixels_per_column: cuuint32_t,
            element_strides: *const cuuint32_t,
            interleave: CUtensorMapInterleave,
            swizzle: CUtensorMapSwizzle,
            l2_promotion: CUtensorMapL2promotion,
            oob_fill: CUtensorMapFloatOOBfill,
        ) -> CUresult;

        pub fn cuTensorMapReplaceAddress(
            tensor_map: *mut CUtensorMap,
            global_address: *mut c_void,
        ) -> CUresult;

        pub fn cuDeviceCanAccessPeer(
            can_access_peer: *mut c_int,
            dev: CUdevice,
            peer_dev: CUdevice,
        ) -> CUresult;

        pub fn cuCtxEnablePeerAccess(peer_context: CUcontext, flags: c_uint) -> CUresult;

        pub fn cuCtxDisablePeerAccess(peer_context: CUcontext) -> CUresult;

        pub fn cuDeviceGetP2PAttribute(
            value: *mut c_int,
            attrib: CUdevice_P2PAttribute,
            src_device: CUdevice,
            dst_device: CUdevice,
        ) -> CUresult;

        pub fn cuGraphicsUnregisterResource(resource: CUgraphicsResource) -> CUresult;

        pub fn cuGraphicsSubResourceGetMappedArray(
            p_array: *mut CUarray,
            resource: CUgraphicsResource,
            array_index: c_uint,
            mip_level: c_uint,
        ) -> CUresult;

        pub fn cuGraphicsResourceGetMappedMipmappedArray(
            p_mipmapped_array: *mut CUmipmappedArray,
            resource: CUgraphicsResource,
        ) -> CUresult;

        pub fn cuGraphicsResourceGetMappedPointer_v2(
            p_dev_ptr: *mut CUdeviceptr,
            p_size: *mut usize,
            resource: CUgraphicsResource,
        ) -> CUresult;

        pub fn cuGraphicsResourceSetMapFlags_v2(
            resource: CUgraphicsResource,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuGraphicsMapResources(
            count: c_uint,
            resources: *mut CUgraphicsResource,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuGraphicsUnmapResources(
            count: c_uint,
            resources: *mut CUgraphicsResource,
            h_stream: CUstream,
        ) -> CUresult;

        pub fn cuGetProcAddress_v2(
            symbol: *const c_char,
            pfn: *mut *mut c_void,
            cuda_version: c_int,
            flags: cuuint64_t,
            symbol_status: *mut CUdriverProcAddressQueryResult,
        ) -> CUresult;

        pub fn cuCoredumpGetAttribute(
            attrib: CUcoredumpSettings,
            value: *mut c_void,
            size: *mut usize,
        ) -> CUresult;

        pub fn cuCoredumpGetAttributeGlobal(
            attrib: CUcoredumpSettings,
            value: *mut c_void,
            size: *mut usize,
        ) -> CUresult;

        pub fn cuCoredumpSetAttribute(
            attrib: CUcoredumpSettings,
            value: *mut c_void,
            size: *mut usize,
        ) -> CUresult;

        pub fn cuCoredumpSetAttributeGlobal(
            attrib: CUcoredumpSettings,
            value: *mut c_void,
            size: *mut usize,
        ) -> CUresult;

        pub fn cuGetExportTable(
            pp_export_table: *mut *const c_void,
            p_export_table_id: *const CUuuid,
        ) -> CUresult;

        pub fn cuGreenCtxCreate(
            ph_ctx: *mut CUgreenCtx,
            desc: CUdevResourceDesc,
            dev: CUdevice,
            flags: c_uint,
        ) -> CUresult;

        pub fn cuGreenCtxDestroy(h_ctx: CUgreenCtx) -> CUresult;

        pub fn cuCtxFromGreenCtx(p_context: *mut CUcontext, h_ctx: CUgreenCtx) -> CUresult;

        pub fn cuDeviceGetDevResource(
            device: CUdevice,
            resource: *mut CUdevResource,
            type_: CUdevResourceType,
        ) -> CUresult;

        pub fn cuCtxGetDevResource(
            h_ctx: CUcontext,
            resource: *mut CUdevResource,
            type_: CUdevResourceType,
        ) -> CUresult;

        pub fn cuGreenCtxGetDevResource(
            h_ctx: CUgreenCtx,
            resource: *mut CUdevResource,
            type_: CUdevResourceType,
        ) -> CUresult;

        pub fn cuDevSmResourceSplitByCount(
            result: *mut CUdevResource,
            nb_groups: *mut c_uint,
            input: *const CUdevResource,
            remaining: *mut CUdevResource,
            useflags: c_uint,
            min_count: c_uint,
        ) -> CUresult;

        pub fn cuDevResourceGenerateDesc(
            ph_desc: *mut CUdevResourceDesc,
            resources: *mut CUdevResource,
            nb_resources: c_uint,
        ) -> CUresult;

        pub fn cuGreenCtxRecordEvent(h_ctx: CUgreenCtx, h_event: CUevent) -> CUresult;

        pub fn cuGreenCtxWaitEvent(h_ctx: CUgreenCtx, h_event: CUevent) -> CUresult;

        pub fn cuStreamGetGreenCtx(h_stream: CUstream, ph_ctx: *mut CUgreenCtx) -> CUresult;

    }
}

pub use api::DriverApi;
